import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:sltchat/page/chat/chat_state.dart';

class ChatLogic extends GetxController {
  ChatState state = ChatState();

  var textFieldController = TextEditingController();

  var scrollController = ScrollController();

  void send() {
    state.chatList.add(ChatListBean(isMe: true, content: state.text.value));
    state.text.value = '';
    textFieldController.clear();
    state.chatList.add(ChatListBean(
        isMe: false,
        content:
            "回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息回复信息"));

    scrollController.animateTo(scrollController.position.maxScrollExtent * 2,
        duration: const Duration(milliseconds: 1000), curve: Curves.linear);
  }
}
